
<html>
<head>
<?php 
include_once( "html_util.php" );
echo link_stylesheet( "layout.css" );
?>
</head>
<?php

echo  generate_header( "Building an Application with Goose" );
echo  generate_navbar();
$html = "<p>To build your new application, start by putting a file in 
the 'www' folder.  You can specify the starting url for the app by 
changing the 'HomeUrl' setting in webui.exe.Config file.  Point it 
to the starting point for your new web application.</p>\n
<p>For example, create a basic php file called 'index.php' and put it in 
the 'www' folder.  The contents of the file will be:</p>
<div class='code'>
  <code>
    &lt;?php <br>
    echo &quot;Hello World!&quot;;<br>
    phpinfo();
    <br>
    ?&gt;
  </code>
</div>

<p>Then open webui.exe.Config and edit the setting key='HomeUrl' so that it
looks like this:<br></p>
<p>
<div class='code'>
  <code>
  &lt;add key=&quot;HomeUrl&quot; value=&quot;http://localhost:8080/www/index.php&quot;/&gt;
  </code>
</div>
<br>
Now start up Goose and see how the page is displayed.
</p>

<p>You can serve up standard html or php web pages.  Goose also 
comes with the sqlite3 extension for database support.  You can easily 
add other php extensions from the standard php installation, but you 
will need to configure them manually.  Check <a href='info.php'>php info</a> 
for more details on the version of php that is installed and check the official
php documentation for details on extensions.</p>

<p>
Extensions are installed in the 'ext' folder by default.
</p>

<p>Here is an example of code to access a database (adapted from the 
sqlite3 php documentation):
</p>
<div class='code'>
  <code>

  \$db = new SQLite3('data/mysqlitedb.db');<br>
  <br>
  \$db->exec('CREATE TABLE foo (bar STRING)');<br>
  \$db->exec(\"INSERT INTO foo (bar) VALUES ('This is a test')\");<br>
  <br>
  \$result = \$db->query('SELECT bar FROM foo');<br>
  var_dump(\$result->fetchArray());<br>
  </code>
</div>
<p>
You can store your database files whereever you like, but the directory
'data' has been created for that purpose.  
</p>
<hr>";

echo $html;


?>

</html>